package com.itheima.test4;

public class GoodsTest {
    public static void main(String[] args) {
        // 定义数组，保存3个商品
        Goods[] arr = new Goods[3];

        //创建商品
        Goods g1 = new Goods("001","小米手机",1999.0,100);
        Goods g2 = new Goods("002","华为手机",3999.0,200);
        Goods g3 = new Goods("003","苹果手机",8999.0,300);

        //保存商品
        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;

        //打印商品信息

        for (int i = 0; i < arr.length; i++) {
            Goods goods = arr[i];
            System.out.println(goods.getId() + " " + goods.getProductName() + " " + goods.getPrice() + " " + goods.getCount());
        }

    }
}
